//
//  WordButton.m
//  LineByLine
//
//  Created by 병철 김 on 11. 11. 7..
//  Copyright (c) 2011 __MyCompanyName__. All rights reserved.
//

#import "WordButton.h"

@implementation WordButton
@synthesize word;

- (id)initWithFrame:(CGRect)frame {
    self = [super initWithFrame:frame];
    if (self) {
        [self setTextAlignment:UITextAlignmentCenter];
        [self setUserInteractionEnabled:YES];
    }
    return self;
}

- (BOOL) isEqualWord:(NSString*) _word {
    return [word isEqualToString:_word];
}

- (void) assistWordButton {
    [self setBackgroundColor:[UIColor redColor]];
    [self setTextColor:[UIColor whiteColor]];
    [self setNeedsDisplay];
    
}

- (void) setTarget:(id) _target action:(SEL) _action {
    target = _target;
    action = _action;
}

- (void) configView {
    [self setText:word];
}

- (void)touchesBegan:(NSSet *)touches withEvent:(UIEvent *)event {
    
}

- (void)touchesEnded:(NSSet *)touches withEvent:(UIEvent *)event {
    [target performSelector:action withObject:self];
}
@end
